package com.tt.task;

import lombok.extern.slf4j.Slf4j;

/**
 * @Title: DefTaskExecutionListenerImpl
 * @Author zl
 * @Package com.ttio.task
 * @Date 2025/7/30 15:31
 * @description: 默认定时任务监控
 */
@Slf4j
public class DefTaskExecutionListenerImpl implements TaskExecutionListener{
    @Override
    public void beforeExecution(MethodTaskInfo taskInfo) {
        log.info("任务开始执行：{}",taskInfo.getMethodName());
    }

    @Override
    public void afterSuccess(MethodTaskInfo taskInfo, Object result, long durationMs) {
        log.info("任务执行成功：{},总耗时 {}",taskInfo.getMethodName(),durationMs);
    }

    @Override
    public void afterFailure(MethodTaskInfo taskInfo, Throwable t, long durationMs) {
        log.info("任务执行失败：{},总耗时 {}",taskInfo.getMethodName(),durationMs);
    }
}
